#include "riscv.h"
#include "lib/print.h"
#include "lib/str.h"
#include "dev/vio.h"
#include "mem/pmem.h"
#include "mem/vmem.h"
#include "mem/mmap.h"
#include "proc/proc.h"
#include "trap/trap.h"
#include "proc/cpu.h"

volatile static int started = 0;

int main()
{
   int cpuid = mycpuid();
   if (cpuid == 0){

      printf("CPU %d is booting!\n", cpuid);
      __sync_synchronize();
      started = 1;   

   }else{
      // CPU 1 等待 CPU 0 完成
      while (started == 0);  
      __sync_synchronize();  

      printf("CPU %d is booting!\n", cpuid);
   }
   while(1);
}